Skip to content

Conversation

williasc
Copy link
Member

On a phone the header took two rows on the search page and three on the wine page, because the links and the search field each got their own row.

Below 768 px the header now shows only the logo and a "Meny" button. The button opens the search field and the links, with "Utforsk" first. On wider screens nothing changes.

How the menu works

  • The button tells screen readers whether the menu is open (aria-expanded).
  • Escape closes the menu and puts focus back on the button.
  • The menu closes when you go to another page, also when you search from it.
  • The search field in the header is inside the menu on mobile. This is what makes the header one line on every page: 68 px high at 375 px, down from 192 px on the wine page.

Testing

npm run check -- --e2e passes.

  • Three new unit tests for opening, Escape and closing on navigation.
  • A new Playwright file, menu.spec.ts, that checks at 375 px that the header is one line, that the menu works with the keyboard, that axe finds no problems with the menu open, and that there is no sideways scroll at 320 px.
  • Some existing mobile tests looked for the header links directly. They now open the menu first, or accept that the link is hidden.

Not tested with VoiceOver by hand yet. That can be done together with #113.

Closes #114

@williasc williasc requested a review from a team as a code owner November 25, 2026 14:43
@williasc williasc linked an issue Nov 25, 2026 that may be closed by this pull request
Copy link
Member

@siverne siverne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested by hand with VoiceOver and Safari in a narrow window. Approving!

  • Closed: «Meny, minimert, knapp». Open: read as expanded.
  • Tab goes to the search field first, then Utforsk, Min side and Logg inn. On / and /sok there is no search in the menu, as those pages have their own.
  • Escape closes the menu, and focus goes back to the button.

@siverne siverne merged commit 4b9c529 into main Nov 25, 2026
@siverne siverne deleted the 114-compact-menu-on-mobile branch November 25, 2026 15:12
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compact menu on mobile
2 participants